<!-- $Id: category_info.htm 16752 2009-10-20 09:59:38Z wangleisvn $ -->
{include file="pageheader.htm"}
<!-- start add new category form -->
<div class="main-div">
  <form action="pickup_point.php" method="post" name="theForm" onsubmit="return validate()">
  <table width="100%" id="general-table">
      <tr>
        <td class="label">{$lang.shop_name}:</td>
        <td>
          <input type='text' name='shop_name' maxlength="20" value='{$pickup_point.shop_name}' size='27' /> <font color="red">*</font>
        </td>
      </tr>
      <tr>
        <td class="label">{$lang.address}:</td>
        <td>
          <input type='text' name='address' maxlength="20" value='{$pickup_point.address}' size='27' /> <font color="red">*</font>
        </td>
      </tr>
      <tr>
        <td class="label">{$lang.contact}:</td>
        <td>
          <input type='text' name='contact' maxlength="20" value='{$pickup_point.contact}' size='27' /> <font color="red">*</font>
        </td>
      </tr>
      <tr>
        <td class="label">{$lang.phone}:</td>
        <td>
          <input type='text' name='phone' maxlength="20" value='{$pickup_point.phone}' size='27' /> <font color="red">*</font>
        </td>
      </tr>
      <tr>
        <td class="label">{$lang.belong_city}:</td>
        <td>
            <select name="province" id="selProvinces" onchange="region.changed(this, 2, 'selCities')">
              <option value="0">{$lang.select_please}</option>
              {foreach from=$province_list item=province}
              <option value="{$province.region_id}"{if $pickup_point.province_id eq $province.region_id}selected="selected"{/if}>{$province.region_name}</option>
              {/foreach}
            </select>
            <select name="city" id="selCities" onchange="region.changed(this, 3, 'selDistricts')">
              <option value="0">{$lang.select_please}</option>
              {foreach from=$city_list item=city}
              <option value="{$city.region_id}"{if $pickup_point.city_id eq $city.region_id}selected="selected"{/if}>{$city.region_name}</option>
              {/foreach}
            </select>
            <select name="district" id="selDistricts">
              <option value="0">{$lang.select_please}</option>
              {foreach from=$district_list item=district}
              <option value="{$district.region_id}"{if $pickup_point.district_id eq $district.region_id}selected="selected"{/if}>{$district.region_name}</option>
              {/foreach}
            </select>
        </td>
      </tr>
      </table>
      <div class="button-div">
        <input type="submit" value="{$lang.button_submit}" />
        <input type="reset" value="{$lang.button_reset}" />
      </div>
    <input type="hidden" name="act" value="{$form_action}" />
    <input type="hidden" name="id" value="{$pickup_point.id}" />
  </form>
</div>
{insert_scripts files="../js/utils.js,validator.js"}
{insert_scripts files="../js/transport.org.js,../js/region.js"}
{literal}
<script language="JavaScript">
region.isAdmin = true;
<!--
document.forms['theForm'].elements['cat_name'].focus();
/**
 * 检查表单输入的数据
 */
function validate()
{
  validator = new Validator("theForm");
  validator.required("shop_name",      '{$lang.shop_name_empty}');
  validator.required("address",      '{$lang.address_empty}');
  validator.required("contact",      '{$lang.contact_empty}');
  validator.required("phone",      '{$lang.phone_empty}');
  if (parseInt(document.forms['theForm'].elements['province'].value) == 0 || parseInt(document.forms['theForm'].elements['city'].value) == 0)
  {
    validator.addErrorMsg('{$lang.select_province}');
  }
  return validator.passed();
}
onload = function()
{
  // 开始检查订单
  startCheckOrder();
}

/**
 * 新增一个筛选属性
 */
function addFilterAttr(obj)
{
  var src = obj.parentNode.parentNode;
  var tbl = document.getElementById('tbody-attr');

  var validator  = new Validator('theForm');
  var filterAttr = document.getElementsByName("filter_attr[]");

  if (filterAttr[filterAttr.length-1].selectedIndex == 0)
  {
    validator.addErrorMsg(filter_attr_not_selected);
  }
  
  for (i = 0; i < filterAttr.length; i++)
  {
    for (j = i + 1; j <filterAttr.length; j++)
    {
      if (filterAttr.item(i).value == filterAttr.item(j).value)
      {
        validator.addErrorMsg(filter_attr_not_repeated);
      } 
    } 
  }

  if (!validator.passed())
  {
    return false;
  }

  var row  = tbl.insertRow(tbl.rows.length);
  var cell = row.insertCell(-1);
  cell.innerHTML = src.cells[0].innerHTML.replace(/(.*)(addFilterAttr)(.*)(\[)(\+)/i, "$1removeFilterAttr$3$4-");
  filterAttr[filterAttr.length-1].selectedIndex = 0;
}

/**
 * 删除一个筛选属性
 */
function removeFilterAttr(obj)
{
  var row = rowindex(obj.parentNode.parentNode);
  var tbl = document.getElementById('tbody-attr');

  tbl.deleteRow(row);
}
//-->
</script>
{/literal}
{include file="pagefooter.htm"}